<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Api\AuthController;
use App\Http\Controllers\Api\Auth2Controller;
use App\Http\Controllers\Api\CaptchaController;
use App\Http\Controllers\Api\SmsController;
use App\Http\Controllers\Api\PublicController;
use App\Http\Controllers\Api\TposController;
use App\Http\Controllers\Api\ShopsController;
use App\Http\Controllers\Api\RoomsController;
use App\Http\Controllers\Api\VideoController;
use App\Http\Controllers\Api\EpisodesController;
use App\Http\Controllers\Api\TracesController;
use App\Http\Controllers\Api\CheckingController;
use App\Http\Controllers\Api\LikesController;
use App\Http\Controllers\Api\RechargeController;
use App\Http\Controllers\Api\ShareController;
use App\Http\Controllers\Api\TaskController;
use App\Http\Controllers\Api\ProjectController;
use App\Http\Controllers\Api\SaleController;
use App\Http\Controllers\Api\AiZhanController;
use App\Http\Controllers\Api\UsersController;
use App\Http\Controllers\Api\CardController;
use App\Http\Controllers\Api\ActingController;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::group([

    'middleware' => ['refresh.token'],
//    'middleware' => ['api'],
    'prefix' => 'auth'

], function () {
    Route::post('logout', [Auth2Controller::class,'logout']);
    Route::post('refresh', [Auth2Controller::class,'refresh']);
    Route::post('me', [Auth2Controller::class,'me']);

    Route::post('modifyuserinfo', [UsersController::class,'ModifyUserInfo']);
    Route::any('myinv', [Auth2Controller::class, 'myInvitation'])->name('myinv');//我的邀请
    Route::any('myconsume', [AuthController::class, 'myConsume'])->name('myConsume');//我的消费记录
    Route::any('myrecharge', [AuthController::class, 'myRecharge'])->name('myrecharge');//我的充值记录

});
//需要登录
Route::group([
    'middleware' => ['auth:api'],
], function () {
    Route::any('checking', [CheckingController::class,'add'])->name('checking');//添加签到
    Route::any('checking/list', [CheckingController::class,'index'])->name('checking/list');//签到列表
    Route::any('wx/pay', [RechargeController::class, 'pay'])->name('wx/pay');//发起支付
    Route::any('share', [ShareController::class, 'store'])->name('share');//分享
    Route::any('task', [TaskController::class, 'index'])->name('task');//任务列表
    Route::any('task/balance', [TaskController::class, 'grantTask'])->name('task/balance');//完成任务

    //追剧
    Route::prefix('trace')->group(function () {
        Route::any('list', [TracesController::class, 'index'])->name('trace/list');//追剧列表
        Route::any('add', [TracesController::class, 'store'])->name('trace/add');//添加追剧
        Route::any('del', [TracesController::class, 'rezuiju'])->name('trace/del');//停止追剧
    });
    //喜欢
    Route::prefix('like')->group(function () {
        Route::any('list', [LikesController::class,'index'])->name('like/list');//喜欢列表
        Route::any('add', [LikesController::class,'store'])->name('like/add');//添加喜欢
        Route::any('del', [LikesController::class,'rezuiju'])->name('like/del');//删除喜欢
    });
    Route::any('trace/recentPlay', [TracesController::class,'recentPlay'])->name('trace/recentPlay');//最近播放
    Route::any('wxphone', [TposController::class, 'getMiniPhone']);

});
Route::group([
    'middleware' => ['apiconfig','apilog'],
    'prefix' => 'service'
], function () {
    Route::any('siteinfos', [AiZhanController::class,'siteinfos'])->name('service/siteinfos');//权重查询
    Route::any('beian/icp', [AiZhanController::class,'icpBeian'])->name('service/beian/icp');//备案查询
    Route::any('intercept', [AiZhanController::class,'intercept'])->name('service/intercept');//域名拦截检测
    Route::any('ipto', [PublicController::class,'ipchaxun'])->name('service/ipto');//域名拦截检测
});
Route::group([
//    'middleware' => ['auth:api'],
    'prefix' => 'card'
], function () {
    Route::any('list', [CardController::class,'lists'])->name('card/list');//获取卡列表
    Route::any('bindcard', [CardController::class,'BindCard'])->name('card/bindcard');//绑定卡
});

Route::group(
  [
      'middleware' => ['Acting'],
      'prefix' => 'acting'
  ], function () {
      Route::any('list', [ActingController::class,'getActing'])->name('acting/list');
  }
);
// 不需要登陆接口
//视频
Route::prefix('video')->middleware('auth:api')->group(function () {
    Route::any('type', [VideoController::class, 'gettype'])->name('video/type');//视频分类
    Route::any('list', [VideoController::class, 'index'])->name('video/list');//视频列表
    Route::any('info', [VideoController::class, 'store'])->name('video/info');//单个视频详情
});
//剧集
Route::prefix('episodes')->group(function () {
    Route::any('list', [EpisodesController::class,'index'])->name('episodes/list');//剧集列表
    Route::any('info', [EpisodesController::class,'store'])->name('episodes/info');//单个剧集详情
});
Route::any('sendemail', [UsersController::class,'sendEmail']);
Route::post('reg', [Auth2Controller::class,'register']);
Route::any('wxmsg/{mp}', [TposController::class, 'getwxmsg']);
Route::post('login', [Auth2Controller::class,'login'])->name('login');
Route::any('captchaGet', [CaptchaController::class,'get'])->name('captcha.get');
Route::any('smsGet', [SmsController::class,'get'])->name('sms.get');
Route::any('test2', [PublicController::class, 'test2'])->name('test');
Route::any('publicNotice', [PublicController::class, 'publicNotice'])->name('publicNotice');
Route::any('carousel', [PublicController::class, 'carousel'])->name('carousel');//轮播图
Route::any('wxlogin', [TposController::class, 'wxlogin'])->name('wxlogin');
Route::any('wxupuserinfo', [TposController::class, 'wx_userinfo'])->name('wxupuserinfo');
Route::any('wxevent', [TposController::class, 'wxevent'])->name('wxevent');
Route::any('shops', [ShopsController::class, 'index'])->name('shops');
Route::any('uploads', [PublicController::class, 'uploadImage2'])->name('uploads');
Route::any('recharge/list', [RechargeController::class, 'index'])->name('recharge/list');//充值列表
Route::any('wxminiapp/notfiy/{mchid}', [RechargeController::class, 'wxNotfiyUrl'])->name('wx/notfiy');//微信小程序回调
Route::prefix('project')->group(function () {
    Route::any('list', [ProjectController::class, 'list'])->name('project/list');//项目列表
    Route::any('info', [ProjectController::class, 'info'])->name('project/info');//项目详情
    Route::any('statusnum', [ProjectController::class, 'ProjectStatus'])->name('project/projectStatus');//项目详情
});
Route::prefix('sale')->group(function () {
    Route::any('performance', [SaleController::class, 'list'])->name('sale/list');//销售排行榜
    Route::any('info', [ProjectController::class, 'info'])->name('project/info');//项目详情
    Route::any('statusnum', [ProjectController::class, 'ProjectStatus'])->name('project/projectStatus');//项目详情
});


Route::any('recommend', [TracesController::class, 'recommend'])->name('recommend');//推荐
Route::any('tuijian', [TracesController::class, 'tuijian'])->name('tuijian');//推荐
Route::prefix('rooms')->group(function () {
    Route::controller(RoomsController::class)->group(function () {
        Route::any('list', 'index');
        Route::any('info', 'show');
    });
});
Route::any('shops/{id}', [ShopsController::class,'show'])->name('shop-show');
Route::any('/test', [PublicController::class,'test'])->name('test');

